package com.jqb.hibernatebbs.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jqb.hibernatebbs.pojo.Bbsmsg;
import com.jqb.hibernatebbs.service.MessageService;
import com.jqb.hibernatebbs.service.impl.MessageServiceImpl;

public class CarriageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		MessageService messageService = new MessageServiceImpl();
		List<Bbsmsg> msgList = messageService.getMessages();
		request.setAttribute("msgList", msgList);
		request.getRequestDispatcher("/WEB-INF/main.jsp").forward(request, response);

	}
}
